#import <Foundation/Foundation.h>
#import <UnitKit/UnitKit.h>
#import "HParser.h"
#import "GNUstep.h"

@interface Test: NSObject <UKTest>
@end

@implementation Test
- (void) testBasic
{
	HParser *parser = [[HParser alloc] initWithContentsOfFile: @"test.html"];
	[parser setDelegate: self];
	[parser setUsePath: YES];
	[parser parse];
	DESTROY(parser);
}

- (void) parser: (HParser *) parser
         foundStartElement: (NSString *) tag
         attributes: (NSDictionary *) attributes
         path: (NSString *) xpath
{
	NSLog(@"<%@ (%@)> (%@)", tag, attributes, xpath);
}

#if 0 // We skip this one to test when delegate method is missimg
- (void) parser: (HParser *) parser
         foundEndElement: (NSString *) tag
         attributes: (NSDictionary *) attributes
         path: (NSString *) xpath
{
	NSLog(@"</%@ (%@)> (%@)", tag, attributes, xpath);
}
#endif

- (void) parser: (HParser *) parser
         foundText: (NSString *) text
         attributes: (NSDictionary *) attributes
         path: (NSString *) xpath
{
	NSLog(@"%@ (%@) (%@)", text, attributes, xpath);
}
@end
